home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2436 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: ix.netcom.com!netnews
  2. From: jmanson@ix.netcom.com(The MadMan )
  3. Newsgroups: alt.msdos.programmer,comp.lang.c
  4. Subject: Re: Pascal program works but not C program!
  5. Date: 21 Jan 1996 13:23:03 GMT
  6. Organization: Netcom
  7. Message-ID: <4dtenn$ik9@cloner2.ix.netcom.com>
  8. References: <4cdpr2$psi@lugb.latrobe.edu.au>  <Pine.SV4.3.91-heb-2.04.960104114930.16292A-100000@cs.technion.ac.il> <4dmpv0$t77@fangz.com>
  9. NNTP-Posting-Host: sdx-ca8-21.ix.netcom.com
  10. X-NETCOM-Date: Sun Jan 21  5:23:03 AM PST 1996
  11.  
  12. In <4dmpv0$t77@fangz.com> shad@fangz.com (Shadow.King) writes: 
  13. >
  14. >: > 
  15. >: > void main(int argc,char *argv[])
  16. >:    ^-----------------------------This one too, but not too serious
  17. >: > {
  18. >: > }
  19. >: > 
  20. >: > 
  21. >
  22. >This isn't really a problem, it's usually just the error code that the
  23.  
  24. >program returns to dos when it exits. As far as I know it doesn't HAVE
  25. to 
  26. >do this so just void main should be fine, I usually do the same thing 
  27. >with simple programs that don't need to set the error level on exit
  28. and 
  29. >I've had no problems whatsoever with it. It is if the program is
  30. supposed 
  31. >to return an error level though.
  32.  
  33. Wait a minute... void main() is NOT correct.  The startup code calls
  34. exit_code = main() and expects a value to be returned to it (it is the
  35. same as one of your routines being called by -   value = function()  
  36. and the function being defined -   void function()   that doesn't
  37. mesh).  Use the C lamguage correcly and it won't bite with little
  38. errors like this.
  39.  
  40. Later, Jon
  41.  
  42.  
  43.